package cn.spiral.test.conf;

import org.quartz.Job;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SimpleTrigger;
import org.quartz.TriggerBuilder;
import org.quartz.TriggerKey;
import org.quartz.impl.StdSchedulerFactory;
import org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean;

public class f5min  implements Job{

	@Override
	public void execute(JobExecutionContext arg0) throws JobExecutionException {
		System.out.println("11111111");
		try {
			Scheduler scheduler= StdSchedulerFactory.getDefaultScheduler();
			System.out.println(scheduler.isStarted());
			//scheduler.shutdown();
			JobDetail jobDetail=JobBuilder.newJob(f_min.class).withIdentity("jobDetail3").usingJobData("s",20).build();
			SimpleTrigger simpleTrigger= (SimpleTrigger) TriggerBuilder.newTrigger().withIdentity("simpleTrigger3").startNow().build();
			scheduler.scheduleJob(jobDetail, simpleTrigger);
			System.out.println(scheduler.checkExists(new JobKey("jobDetail")));
			System.out.println(scheduler.checkExists(new TriggerKey("simpleTrigger1")));
			JobDetail jobDetail2 = scheduler.getJobDetail(new JobKey("jobDetail3"));
			System.out.println(jobDetail2.toString());
			scheduler.pauseTrigger(new TriggerKey("simpleTrigger2"));
			System.out.println(scheduler.checkExists(new JobKey("jobDetai1")));
		} catch (SchedulerException e) {
			e.printStackTrace();
		}
		
	}
	
}
